package mytest

import "fmt"

type PersionInfo struct {
	ID   string
	Name string
	Age  int
}

func CallMap() {
	personDb := make(map[string]PersionInfo)
	personDb["1"] = PersionInfo{ID: "1", Name: "Tom", Age: 18}
	personDb["123"] = PersionInfo{ID: "123", Name: "Jerry", Age: 19}

	person, ok := personDb["1"]
	if ok {
		fmt.Println(person.Name)
	} else {
		fmt.Println("没有找到该用户")
	}

	fmt.Println("删除用户 1")
	delete(personDb, "1")
	person, ok = personDb["1"]
	if ok {
		fmt.Println(person.Name)
	} else {
		fmt.Println("没有找到该用户")
	}

	personDb["1"] = PersionInfo{ID: "1", Name: "Jam", Age: 28}
	person, ok = personDb["1"]
	if ok {
		fmt.Println(person.Name)
	} else {
		fmt.Println("没有找到该用户")
	}
	
}
